// 年月日格式化
function formatDateOfYMD(time, sep = "-") {
  if (!time) return false;
  let date = new Date(time);
  let year = date.getFullYear();
  let month =
    date.getMonth() + 1 < 10
      ? "0" + (date.getMonth() + 1)
      : date.getMonth() + 1;
  let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  let afterFormatDate = year + sep + month + sep + day;
  return afterFormatDate;
}

// 年月日格式化（中文）
function formatDateOfYMD_C(time) {
  if (!time) return false;
  let date = new Date(time);
  let year = date.getFullYear();
  let month =
    date.getMonth() + 1 < 10
      ? "0" + (date.getMonth() + 1)
      : date.getMonth() + 1;
  let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  let afterFormatDate = year + "年" + month + "月" + day + "日";
  return afterFormatDate;
}

function formatDateOfYM(time, sep = "-") {
  if (!time) return false;
  let date = new Date(time);
  let year = date.getFullYear();
  let month =
    date.getMonth() + 1 < 10
      ? "0" + (date.getMonth() + 1)
      : date.getMonth() + 1;
  let afterFormatDate = year + sep + month;
  return afterFormatDate;
}

function formatDateOfYM_C(time) {
  if (!time) return false;
  let date = new Date(time);
  let year = date.getFullYear();
  let month =
    date.getMonth() + 1 < 10
      ? "0" + (date.getMonth() + 1)
      : date.getMonth() + 1;
  let afterFormatDate = year + "年" + month + "月";
  return afterFormatDate;
}

export { formatDateOfYMD, formatDateOfYMD_C, formatDateOfYM, formatDateOfYM_C };
